import Vue from 'vue'
import App from './App.vue'
import router from '@/router'
import store from '@/store'
// import axios from 'axios';
import axios from '@/utils/http'

// 自定义css样式
import '@/assets/css/common.css';
import '@/assets/css/style.css';
import '@/assets/css/theme.css';
import '@/assets/styles/index.scss'
import '@/assets/font/iconfont/iconfont.css'

//登录粒子背景
import VueParticles from 'vue-particles'
Vue.use(VueParticles)

// element-ui
import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';
Vue.use(ElementUI);

// 导入表格树https://blog.csdn.net/gaogzhen/article/details/108090145
//npm install --save vue-table-with-tree-grid
import ZkTable from 'vue-table-with-tree-grid'
// 组件全局注册 表格树
Vue.component('tree-table', ZkTable)

// 引入echarts以及中国地图china.js
// npm install echarts@4.9.0
// npm install echarts-wordcloud@1.0.0
import * as echarts from 'echarts';
import '../node_modules/echarts/map/js/china';
import '../node_modules/echarts-wordcloud/dist/echarts-wordcloud'
Vue.prototype.$echarts = echarts;

// mavonEditor
import mavonEditor from 'mavon-editor'
import 'mavon-editor/dist/css/index.css'
Vue.use(mavonEditor)

//时间戳转化成格式时间
Vue.filter('dataFormat', function (originVal) {
  const dt = new Date(originVal * 1000) //时间戳为10位需*1000，时间戳为13位的话不需乘1000
  const y = dt.getFullYear()
  const m = (dt.getMonth() + 1 + '').padStart(2, '0')
  const d = (dt.getDate() + '').padStart(2, '0')

  const hh = (dt.getHours() + '').padStart(2, '0')
  const mm = (dt.getMinutes() + '').padStart(2, '0')
  const ss = (dt.getSeconds() + '').padStart(2, '0')
  // yyyy-mm-dd hh:mm:ss
  return `${y}-${m}-${d} ${hh}:${mm}:${ss}`
})
//引入全屏组件并注册
import fullscreen from 'vue-fullscreen'
Vue.use(fullscreen)
//引入导出EXCEL表格
import JsonExcel from 'vue-json-excel'
Vue.component('downloadExcel', JsonExcel)

// 挂在到Vue实例，后面可通过this调用
Vue.prototype.$http = axios;

Vue.config.productionTip = false

new Vue({
  router,
  store,
  axios,
  echarts,
  render: h => h(App)
}).$mount('#app')
